import Layout from "@/Layout";
import CateLists from "@/pages/CateLists";
import DashBoard from "@/pages/DashBoard";
import ItemAdd from "@/pages/ItemAdd";
import ItemLists from "@/pages/ItemLists";
import ItemUpdate from "@/pages/ItemUpdate";
import Login from "@/pages/Login";
import NotFound from "@/pages/NotFound";
import Settings from "@/pages/Settings";
import UserInfo from "@/pages/UserInfo";
import { Navigate } from 'react-router-dom';
const routes = [
  {
    path: '/',
    element: <Layout/>,
    roles: '*',
    children: [
      {
        path: 'dashBoard',
        roles: '*',
        element: <DashBoard/>
      },
      {
        path: 'cateLists',
        roles: ['superAdmin', 'admin', 'a'],
        element: <CateLists/>
      },
      {
        path: 'itemLists',
        roles: ['superAdmin', 'admin', 'a'],
        element: <ItemLists/>
      },
      {
        path: 'itemAdd',
        roles: ['superAdmin', 'admin', 'a'],
        element: <ItemAdd/>
      },
      {
        path: 'itemUpdate',
        roles: ['superAdmin', 'admin', 'a'],
        element: <ItemUpdate/>
      },
      {
        path: 'userInfo',
        roles: ['superAdmin', 'admin', 'a'],
        element: <UserInfo/>
      },
      {
        path: 'settings',
        roles: ['superAdmin',  'a'],
        element: <Settings/>
      },
      {
        path: '/',
        roles: "*",
        element: <Navigate to="/dashBoard" replace/>
      }
    ]
  },
  {
    path: '/login',
    roles: "*",
    element: <Login/>
  },
  {
    path: '*',
    roles: "*",
    element: <NotFound/>
  }
]

export default routes